<?php

class Model_Banner extends Model
{
	function __construct($id = 0)
	{
		parent::__construct();
		$this->properties['banners'] = array(
		    'id',
            'creator_id',
            'client_id',
			'title',
			'url',
			'width',
			'width_in_percents',
			'height',
			'height_in_percents',
			'code_block',
			'start_date',
			'end_date',
			'cdate',
			'is_active',
			'clicks_limit',
			'views_limit',
			'daily_clicks_limit',
			'daily_views_limit',
			'geotargeting',
		);
		$this->cdate = time();
		if ($id)
		{
		    $this->getBy('id', $id);
		}
	}
	
	function delete()
	{
		UploadMedia::Clear($this->image_name);
		parent::delete();
	}
}